{\rtf1\ansi\deff2\adeflang1025
{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\fmodern\fprq1\fcharset0 Courier New;}{\f4\fnil\fprq2\fcharset0 Mangal;}{\f5\fnil\fprq0\fcharset128 Mangal;}{\f6\fnil\fprq2\fcharset0 Microsoft YaHei;}}
{\colortbl;\red0\green0\blue0;\red0\green0\blue128;\red128\green128\blue128;}
{\stylesheet{\s0\snext0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033 Default;}
{\*\cs15\snext15\cf2\ul\ulc0\hich\af2\langfe255\dbch\af2\loch\f2\fs24\lang255 Internet link;}
{\*\cs16\snext16\cf2\ul\ulc0\langfe255\lang255 Internet Link;}
{\s17\sbasedon0\snext18{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb240\sa120\keepn\cf0\hich\af4\langfe1033\dbch\af6\loch\f2\fs28\lang1033 Heading;}
{\s18\sbasedon0\snext18{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb0\sa120\cf0\hich\af2\langfe1033\dbch\af2\loch\f2\fs24\lang1033 Text body;}
{\s19\sbasedon18\snext19{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb0\sa120\cf0\hich\af2\langfe1033\dbch\af2\loch\f2\fs24\lang1033 List;}
{\s20\sbasedon0\snext20{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb120\sa120\cf0\i\hich\af5\langfe1033\dbch\af2\ai\loch\f2\fs24\lang1033 Caption;}
{\s21\sbasedon0\snext21{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\cf0\hich\af2\langfe1033\dbch\af2\loch\f2\fs24\lang1033 Index;}
{\s22\sbasedon0\snext22{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb120\sa120\cf0\i\hich\af2\langfe1033\dbch\af2\ai\loch\f2\fs24\lang1033 caption;}
{\s23\snext0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033 heading 1;}
{\s24\snext0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033 heading 2;}
{\s25\snext0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033 heading 3;}
}{\info{\creatim\yr0\mo0\dy0\hr0\min0}{\revtim\yr0\mo0\dy0\hr0\min0}{\printim\yr0\mo0\dy0\hr0\min0}{\comment OpenOffice}{\vern4120}}\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720\deftab720

{\*\pgdsctbl
{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\pgdscnxt0 Standard;}}
\formshade{\*\pgdscno0}\paperh15840\paperw12240\margl1800\margr1800\margt1440\margb1440\sectd\sbknone\sectunlocked1\pgndec\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
\pgndec\pard\plain \s23{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\i0\b\afs32\ai0\ab\rtlch \ltrch\loch\fs32
Media Foundation .NET v3.1}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\rtlch \ltrch\loch
}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
The current version of this library is available at http://mfnet.SourceForge.Net and is the result of work done by:}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{{\field{\*\fldinst HYPERLINK "mailto:snarfle@users.SourceForge.net" }{\fldrslt \cf2\ul\ulc0\langfe255\lang255\cf2\ul\ulc0\hich\af2\langfe255\rtlch \ltrch\loch\fs24\lang255
snarfle@users.SourceForge.net}}}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\cf2\ul\ulc0\langfe255\rtlch \ltrch\loch\lang255
nowinskie@users.SourceForge.net}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb0\sa100\ltrpar{\rtlch \ltrch\loch
}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
See WhatsNew.txt for a list of what has changed since the previous version.  See also readme.mfext.html for details about using the mfnet extensions.}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Purpose of this library - What it is, what it isn't}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Despite the fact that Microsoft has just released a brand new interface for working with multimedia in Vista, they haven\'92t chosen to provide access to it for managed code developers.  This library opens up MF for use in managed applications.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
Reviewing the source code will show that there is very little executable code in this library.  There are a few helper functions, but everything else in the library is just definitions.  There isn\'92t some large complex set of classes hidden somewhere that does the work.  Essentially, this library is a simple mapping between managed and unmanaged code.  As a result, there is little opportunity for any problems you encounter to be caused by the library.  Not zero chance, but by and large, you may expect that problems you encounter when using the library are not a result of bugs in the library (see \'93Reporting bugs\'94 below).}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Although there are over 100 interfaces defined in the source code, only some of them have been tested to ensure that they will work correctly (see \'93Using untested interfaces\'94 and \'93The plan for additional interfaces\'94 below).  The list of interfaces indicating which ones have been tested can be found at interaces.txt.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
In addition to the library, a number of samples are provided showing how to use the library.  The samples are in a separate download.}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Licensing}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
This library is licensed under either GNU LESSER GENERAL PUBLIC LICENSE, Version 2.1 or BSD.  See license.txt or BSDL.txt for the complete text.  I\'92m a programmer, not a lawyer, so please, if you have questions regarding licensing, direct them to your lawyer (who undoubtedly knows more about LGPL and BSD than I do).}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Supported platforms, languages}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
This library is usable from c#, and should work from other .NET compatible languages.  It was tested against Vista sp0 using the 3.5 .NET framework.  The library should work for both 32 bit and 64 bit versions.}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Where to find the documentation}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Since the purpose of this library is to allow for the calling of the Media Foundation interfaces, the primary source of documentation is MSDN.  You can find the Media Foundation documentation at https://msdn.microsoft.com/en-us/library/windows/desktop/ms694197%28v=vs.85%29.aspx (at least until the next time Microsoft re-orgs their web site).  The few helper classes in the library are documented below in \'93Helper Classes\'94.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch
}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
New in v2.2, it is now possible to get MSDN help for MFNet interfaces inside Visual }
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Studio. Run docs\\insthelp.cmd to configure this features for VS2012, 2013 & 2015.}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Differences between MSDN docs and using this library}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
It most cases, you should expect that you call the interface methods the same way MSDN says it should be called.  The primary differences are places where MSDN documents method parameters as int, but then says the content of the int is some enum.  The library\'92s definition is changed to be the enum, so Visual Studio\'92s intelli-sense will offer up the legal values while typing code.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
The names of the structures and enum have been changed to use a more .NET friendly style: AM_SAMPLE2_PROPERTIES -> AMSample2Properties.  Note that the original C++ structure or enum name is provided in an attribute above the declaration.  If there is some specific declaration you need to find, do a scan of the library\'92s source files for the name.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Also see the sections below on \'93Error handling\'94 and \'93How and when to use Marshal.ReleaseComObject()\'94.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch
}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Error handling}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
(If you are already familiar with PreserveSig and the effects it has on COM interfaces, you can skip this section.)}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch
}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
How and when to use Marshal.ReleaseComObject()}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
.NET has a built-in limitation when handling COM methods.  This problem affects any .NET class calling COM, not just this library.  The problem description is rather involved, but boils down to two key facts:}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
1) Objects in .NET aren't released as soon as they go out of scope.  You have to wait for the Garbage Collector to free them.  As a result, you may get "in use" errors for items you thought should be released.  GC.Collect may help with this.  Also, you can use Marshal.ReleaseComObject.  However, that may introduce other problems (see #2).}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
2) If you create a COM object, then do }
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\hich\af3\dbch\af3\rtlch \ltrch\loch\fs20\loch\f3
IGraphBuilder  graphBuilder = (IGraphBuilder) new FilterGraph();}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20\loch\f3
IMediaControl  imc = graphBuilder as IMediaControl;}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Calling Marshal.ReleaseComObject on either graphBuilder or imc will invalidate BOTH graphBuilder and imc.  For a good article on this, read Chris Brumme's weblog at http://blogs.msdn.com/cbrumme/archive/2003/04/16/51355.aspx.}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Helper Classes}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
While the library primarily provides mappings to the Media Foundation interfaces, there are a few helper functions defined that may be useful:}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\b\afs20\ab\rtlch \ltrch\loch\fs20
PropVariant}{\afs20\rtlch \ltrch\loch\fs20
 \'96 This class is a c# implementation of the PROPVARIANT structure.  It has a collection of constructors to allow creation of various forms of PROPVARIANTs, and accessors to allow reading.  }
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Note that since this is implemented as a class, there is no need to have any c# equivalent to VariantInit, and since custom marshaling is used in parameter passing, there is no need to release variants between calls to avoid leaks.  However, there is a Clear() method to ensure timely release of data should that be desirable.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\b\afs20\ab\rtlch \ltrch\loch\fs20
ConstPropVariant}{\afs20\rtlch \ltrch\loch\fs20
 \'96 This class is the parent of PropVariant.  It is used for parameters that are sent from unmanaged code where the callee (ie the managed code) should NOT clear the variant.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\b\afs20\ab\rtlch \ltrch\loch\fs20
MFInt}{\afs20\rtlch \ltrch\loch\fs20
 \'96 This class is a wrapper for ints.  The only time you should need to use this class is if you are dealing with parameters to (or from) MF that are \'93out int\'94, but \'93can be null.\'94  If you are implementing a method that has such a datatype, you will want to check the value to see if it is null, then use the Assign() method to assign a value.  See GetStreamLimits in the MFT_GrayScale sample for how this works.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\b\afs20\ab\rtlch \ltrch\loch\fs20
FourCC}{\afs20\rtlch \ltrch\loch\fs20
 - This class is useful for processing 4cc (see http://msdn2.microsoft.com/en-us/library/ms783788.aspx for a discussion of some of the basics of 4 character codes).  It contains methods for converting from ints to 4cc\'92s and Guids.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch
}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\b\afs20\ab\rtlch \ltrch\loch\fs20
COMBase}{\afs20\rtlch \ltrch\loch\fs20
 \'96 This class is intended to be the parent of classes that implement COM interfaces.  It can also be used as a parent to classes that merely call COM classes, and the methods can also be called statically.  Note: There is no requirement to use this class, but it can be helpful.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch
}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
Succeeded: Checks to see if an HRESULT code is not a failure code (ie >= 0).  This isn\'92t generally useful since most methods in the library with throw exceptions rather than returning HRESULTs.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Failed: Checks to see if an HRESULT code is a failure code (ie < 0).  This isn\'92t generally useful since most methods in the library with throw exceptions rather than returning HRESULTs.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
SafeRelease: Calls Dispose or Marshal.ReleaseComObject against objects.  Checks for null.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\b\afs20\ab\rtlch \ltrch\loch\fs20
MFError}{\afs20\rtlch \ltrch\loch\fs20
 \'96 This class contains two methods.  }
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
ThrowExceptionForHR is a wrapper for Marshal.ThrowExceptionForHR, but additionally provides descriptions for any Media Foundation specific error messages.  Note that you do not have to check for negative values before calling this method.  If the hr value is not a fatal error, no exception will be thrown:}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\hich\af3\dbch\af3\rtlch \ltrch\loch\fs20\loch\f3
hr = iSomething.DoSomething();}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20\loch\f3
MFError.ThrowExceptionForHR(hr);}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch
}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
GetErrorText returns a string representation of HRESULTs.  This works for both Media Foundation error codes, and general COM error codes.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\b\afs20\ab\rtlch \ltrch\loch\fs20
WaveFormatEx, WaveFormatExWithData, WaveFormatExtensible, WaveFormatExtensibleWithData}{\afs20\rtlch \ltrch\loch\fs20
 \'96 C++ has this trick they do where they pass a pointer to a WaveFormatEx, then you parse the data to figure out whether the struct is really a WaveFormatEx, or a WaveFormatExtensible.  What\'92s more, there can be some random number of bytes *after* the structure.  In order to deal with this in c# (which doesn\'92t care for these types of shenanigans), these 4 items have been declared as classes with methods to facilitate performing this same magic for you automatically in c#.  }
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
If you call a method that returns a \'93WaveFormatEx,\'94  you can determine if it is a WaveFormatExtensible by using the c# as operator to cast it (among other methods).}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\b\afs20\ab\rtlch \ltrch\loch\fs20
BitmapInfoHeader, BitmapInfoHeaderWithData}{\afs20\rtlch \ltrch\loch\fs20
 \'96 BitmapInfoHeader has the same issues as WaveFormatEx.  See the description above.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\b\afs20\ab\rtlch \ltrch\loch\fs20
PVMarshaler, RTIMarshaler, RTAMarshaler, GAMarshaler, WEMarshaler, BMMarshaler}{\afs20\rtlch \ltrch\loch\fs20
 \'96 These classes handle the custom marshaling for PropVariants, WaveFormatEx, MFTGetInfo, MFTRegister, MFTEnum.  There should be no reason to use any of these directly.}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Using untested interfaces}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
The MediaFoundation source code contains interfaces for virtually all of Media Foundation as of the date it was created.  Currently, however, only some of them have been tested.  Testing includes performing each of these on each method of the interface:}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
1) Checking to see that the method is defined correctly according to the MSDN docs}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
2) Change int to enum where needed}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
3) Add any needed MarshalAs}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
4) Verify that any needed structs are correctly defined }
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
5) Remove unneeded "ref", add needed "out"}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
6) (Where possible) remove IntPtr and use actual structs or classes}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
7) Where necessary, create custom marshalers for passing structs}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
8) Write code that calls the method, making sure parameters that are documented to accept null, do so}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
However, it may be that you need to use an interface that hasn't been tested yet.  All the untested interfaces, structs and enum are included in the source, but are wrapped within:}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\li0\ri0\lin0\rin0\fi360\sb100\sa100\ltrpar{\hich\af3\dbch\af3\rtlch \ltrch\loch\fs20\loch\f3
#if ALLOW_UNTESTED_INTERFACES}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20\loch\f3
#endif}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Release builds of the library do not expose these interfaces.  If you want to enable all the methods, you can use #define in specific source files or globally with project properties to define this constant, and then build your own copy of the library.  However, don't be surprised if some of the methods/interfaces that haven't been tested don't work correctly.  Also, when the method is eventually tested, the definition may be modified.}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
The plan for additional interfaces}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
The plan is to continue testing interfaces and moving them out of the #if.  However, no particular schedule is planned at this point.  If you have some specific methods that you would like to see tested, or if you have tested (all the methods on) an interface and would like to see it included in the library, post a message to the Open Discussion forum discussed in \'93Links for help\'94 below.}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Reporting bugs}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Bugs in this library should be reported to http://sourceforge.net/tracker/?group_id=199925&atid=971446.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
Note that only bugs in the library, samples, or docs that are part of this project should be reported here.  Bugs in Media Foundation itself must be reported to Microsoft.}
\par \pard\plain \s25{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb240\sa60\keepn\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Links for help}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
Your best place to start is the MSDN docs (see links under "Where to find the documentation").  If your question is about Media Foundation in general, you might want to post to one of Microsoft's newsgroups (currently at https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?forum=mediafoundationdevelopment).  If your question is specific to this library, you should post your question post in the \'93Open Discussion\'94 forum here: https://sourceforge.net/p/mfnet/discussion/711229/.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch
}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\b\afs26\ab\rtlch \ltrch\loch\fs26
Errata}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\sb100\sa100\ltrpar{\afs20\rtlch \ltrch\loch\fs20
The following items are minor variations between the MSDN docs and the .Net implementation.  I don\'92t expect these to ever be an issue for anyone, but I wanted a place to keep track of them.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
Output parameters that \'93can be NULL if the value is not needed\'94 present problems for .Net.  If you declare them as \'93out,\'94 then if someone tries to pass you a NULL, the .Net framework rejects the call.  The only way around this is to declare the parameter as IntPtr.  This is a PITA for the majority of people who just want to use the typed field, and will never try to implement an interface.  For the cases below, I don\'92t believe the interface is intended to be implemented, only called.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
There are a few methods on a few interfaces where the return value from the method is NOT an HRESULT.  In these cases, you must use PreserveSig to make sure the actual value can be retrieved.  It\'92s possible that people will assume that all methods will throw an exception, and not manually throw the exception on the failure.  Doesn\'92t seem like a big problem.  There are also a few cases where the method might return S_* error codes.  However, the status messages don\'92t seem to be of value, so I have left the PreserveSig off for them, resulting in any potential S_ code being discarded.}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\afs20\rtlch \ltrch\loch\fs20
IMFSourceResolver::BeginCreateObjectFromURL cookie param can be null}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
IMFAttributes::GetString p4 can be null}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
IMFVideoDisplayControl::SetBorderColor uses int instead of COLORREF (this is done a lot)}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
IMFMediaBuffer::Lock can accept nulls}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
MFVideoSurfaceInfo has unmarshalled array.  Custom?}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch\fs20
IMFMediaTypeHandler::IsMediaTypeSupported has optional parm}
\par \pard\plain \s0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\nowidctlpar\cf0\hich\af2\langfe1033\dbch\af2\afs24\lang1081\loch\f2\fs24\lang1033\ltrpar{\rtlch \ltrch\loch
}
\par }